package com.hzt.agprosaleplatform.entity;

import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 内存存储的聊天会话实体类
 */
@Data
public class MemoryChatSession {
    private String sessionId;           // 会话ID（格式：buyerId_shopId）
    private String buyerId;             // 买家ID
    private String shopId;             // 店铺ID
    private String shopName;           // 店铺名称
    private String buyerName;          // 买家名称
    private LocalDateTime createTime;  // 创建时间
    private LocalDateTime lastMessageTime; // 最后消息时间
    private List<MemoryChatMessage> messages = new CopyOnWriteArrayList<>(); // 消息列表
    
    public MemoryChatSession(String buyerId, String shopId, String buyerName, String shopName) {
        this.sessionId = buyerId + "_" + shopId;
        this.buyerId = buyerId;
        this.shopId = shopId;
        this.buyerName = buyerName;
        this.shopName = shopName;
        this.createTime = LocalDateTime.now();
        this.lastMessageTime = LocalDateTime.now();
    }
}